<?xml version="1.0"?>
<html>
	<head>
		<link rel="stylesheet" type="text/css" tal:attributes="href string:${cssRootFolderUrl}stock.css" />
		<link rel="stylesheet" type="text/css" tal:attributes="href string:${cssRootFolderUrl}global.css" />
		<style>
			.disabled {
			opacity : 0.4;
			filter: alpha(opacity=40); /* msie */;
			}
		</style>
	</head>
	<body>
		<form action='insertProduct.php' method='post' id='insertProductForm'>
			<table>
				<tr>
					<td>productName:</td>
					<td><input type="text" id="productNameInput"></input></td>
				</tr>
				<tr>
					<td>packageType:</td>
					<td>
						<select id="packageTypeInput" name="packageUnitId">
							<option tal:repeat="item stock/listPackageTypeIds" tal:attributes="Value item/0"><span tal:content="item/1"/></option>
						</select>
					</td>
				</tr>
				<tr>
					<td>natrium / 100g:</td>
					<td><input type="text" id="natriumInput"></input></td>
				</tr>
				<tr>
					<td>kCal / 100g:</td>
					<td><input type="text" id="caloriesInput"></input></td>
				</tr>
				<tr>
					<td colspan="2">
						<!--button>Insert</button-->
						<input type="submit" value="insert"/>
					</td>
				</tr>
			</table>
			<div id="insertProductActionUrl" tal:content="insertProductActionUrl"/>
			<span id="eee" tal:define="global productId string:5"/>
			<span tal:define="global packageTypeId string:3"/>
			<span tal:define="global name string:Sprite"/>
			<!--div id="insert" tal:content="php:stock.insert(productId,packageTypeId,name)"/-->
		</form>
	</body>
	<script type="text/javascript" src="http://code.jquery.com/jquery-latest.pack.js"></script>
	<script type="text/javascript">
		/*$("button").click(function(){
			var productName = $("#productNameInput").val();
			var packageType = $("#packageTypeInput option:selected").val();
			var natrium = $("#natriumInput").val();
			var calories = $("#caloriesInput").val();
			$("body").append('tal:content="php:stock.insert(productId,packageTypeId,name)"');
			$("body").append(packageType);
		});*/
		document.write($("#insertProductActionUrl").text());
		$('#myForm').submit(function(event){  //added event
			event.preventDefault(); //added to prevent submit
			/*$.ajax
				({ 
				type: 'POST', 
				url: $("#insertProductActionUrl").text(), 
				data: data, success: 
				success function(data, textStatus, jqXHR),
				complete: function(),
				dataType: dataType 
			});*/
		});
	</script>
</html>